//
//  BaseAlterController.m
//  SleepingElf
//
//  Created by karong on 2023/6/21.
//

#import "BaseAlterController.h"

@interface BaseAlterController ()




@end

@implementation BaseAlterController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self layoutView];
}

- (void)layoutView {
    if (!SEIsNullOrEmpty(self.titleStr))self.titleLabel.text = self.titleStr;
    if (!SEIsNullOrEmpty(self.contentStr))self.contentLabel.text = self.contentStr;
    if (!SEIsNullOrEmpty(self.confirmStr))[self.confirmBtn setTitle:self.confirmStr forState:(UIControlStateNormal)];
    if (!SEIsNullOrEmpty(self.cancelStr))[self.cancelBtn setTitle:self.cancelStr forState:(UIControlStateNormal)];
}

- (IBAction)confirmAction:(id)sender {
    [self dismissViewControllerAnimated:YES completion:^{
        if (self.confirmHandle)self.confirmHandle();
    }];
    
}

- (IBAction)cancelAction:(id)sender {
    [self dismiss];
}

- (void)setTitleStr:(NSString *)titleStr {
    _titleStr = titleStr;
    self.titleLabel.text = titleStr;
}

@end
